package cn.lg.soar.redis.serializer;

import cn.lg.soar.core.util.InnerSerializeUtils;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.SerializationException;

/**
 * 自定义序列化器
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public class SoarRedisSerializer implements RedisSerializer<Object> {

    @Override
    public byte[] serialize(Object o) throws SerializationException {
        return InnerSerializeUtils.serializeToBytes(o);
    }

    @Override
    public Object deserialize(byte[] bytes) throws SerializationException {
        return InnerSerializeUtils.deserializeByBytes(bytes);
    }

}
